import 'package:flutter/cupertino.dart';
import 'package:mobile_app.core/core/presentation/theme/theme.dart';
import 'package:mobile_app.core/core/presentation/widgets/app_button.dart';

class OverlayButton extends StatelessWidget {
  const OverlayButton({
    required this.onPressed,
    required this.child,
    super.key,
  });

  final Widget child;
  final VoidCallback? onPressed;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(20),
        boxShadow: CoreTheme.of(context).overlayButtonShadows,
      ),
      child: AppButton(
        color: CoreTheme.of(context).primaryColor,
        disabledColor: CoreTheme.of(context).primaryColor,
        pressedOpacity: 0.6,
        onPressed: onPressed,
        borderRadius: BorderRadius.circular(20),
        child: Container(
          width: double.infinity,
          height: 55,
          constraints: const BoxConstraints(
            maxWidth: 500,
          ),
          child: Center(
            child: child,
          ),
        ),
      ),
    );
  }
}

class OverlayTextButton extends StatelessWidget {
  const OverlayTextButton({
    required this.title,
    required this.onPressed,
    super.key,
  });

  final String title;
  final VoidCallback? onPressed;

  @override
  Widget build(BuildContext context) {
    return OverlayButton(
      onPressed: onPressed,
      child: Text(
        title,
        style: CoreTheme.of(context).textTheme.overlayButton,
        textAlign: TextAlign.center,
      ),
    );
  }
}
